From Cppreference
|
|
|
|
|
|
|
template< class ForwardIterator, class Size, class T >
void uninitialized_fill_n( ForwardIterator first, Size count
const T& value )
|
|
|
|
|
|
Copies the given value value to the first count elements in an uninitialized memory area beginning at first. The elements in the uninitialized area are constructed using copy constructor.
[edit] Parameters
| first
| -
| the beginning of the range of the elements to initialize
|
| count
| -
| number of elements to construct
|
| value
| -
| the value to construct the elements with
|
[edit] Return value
iterator to the element past the last element copied.
[edit] Complexity
linear in count
[edit] Equivalent function
template< class ForwardIterator, class Size, class T >
void uninitialized_fill_n(ForwardIterator first, Size count
const T& value)
{
typedef typename std::iterator_traits<ForwardIterator>::value_type Value;
for (; count > 0; ++first, --count) {
::new (static_cast<void*>(&*first)) Value(value);
}
return first;
}
|
[edit] Example
[edit] See also
|
|
|
| copies an object to an uninitialized area of memory (function template)
|